
<?php 

header("Content-type: text/html; charset=utf-8"); 

$_FILES;
var_dump($_FILES);


if($_FILES['file']['size']>3000){
	echo '允许上传';
}else{
	echo '不允许上传';
}

$allowArr= ['jpg','png','gif'];
$arr = explode('.',$_FILES['file']['name']);    //用点把数组分割
$type =end($arr);


if(!in_array($type, $allowArr)){
	echo "文件不符合要求上传失败";exit;
}else{
	echo '文件符合要求上传成功';
}




move_uploaded_file($_FILES['file']['tmp_name'],'./img/'.uniqid().'.'.$type);   


?>